package com.jiangsong.mq;

import com.jiangsong.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Slf4j
@Service
@RocketMQMessageListener(topic = "TopicTest", consumerGroup = "ConsumerGroupTest")
public class MyConsumer implements RocketMQListener<String> {


    @Autowired
    ProductService productService;


    @Override
    public void onMessage(String message) {

        log.info("test onMessage 接收到消息: {}", message);

        boolean dealSuccess = productService.createFeeRateWhenNewSignAccWithTransaction(message);

        log.info("test onMessage 消息处理完成: {},处理结果:{}", message, dealSuccess);

    }
}

